﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yq.Exchange
{
    /// <summary>
    /// 动态调用WCF
    /// </summary>
    internal static class WcfClient
    {
        /// <summary>
        /// 创建wcf请求
        /// </summary>
        /// <typeparam name="T">类型</typeparam>
        /// <param name="endpointName">链接地址</param>
        /// <returns></returns>
        public static T Create<T>(string endpointName)
        {
            if (string.IsNullOrEmpty(endpointName))
            {
                throw new ArgumentNullException("链接地址不能为空！");
            }
            return (T)(new ServiceRealProxy<T>(endpointName).GetTransparentProxy());
        }
    }

}
